VisualStudio2019修改注释快捷键和添加自定义头部注释 | 您所在的位置:网站首页 › 如何打开vba编辑器 快捷键 › VisualStudio2019修改注释快捷键和添加自定义头部注释 |
1、修改注释快捷键
将"编辑.切换行注释"的快捷键修改为"Alt+/",点击"分配",“确定”,即可完成 Visual Studio 2019 注释快捷键的修改(修改为"Alt+/"),返回编辑器书写代码,对指定行添加注释和取消注释已成功。 2、添加自定义 C# 代码头部注释打开 Visual Studio 2019 安装路径:E:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\ItemTemplates\CSharp\Code\2052,修改如下文件: (1)E:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\ItemTemplates\CSharp\Code\2052\Class\Class.cs using System;using System.Collections.Generic;$if$ ($targetframeworkversion$ >= 3.5)using System.Linq;$endif$using System.Text;$if$ ($targetframeworkversion$ >= 4.5)using System.Threading.Tasks;$endif$namespace $rootnamespace${/// ///********************************************/// ClassName : $safeitemrootname$/// Author : WeiXiaolei/// CreateTime : $time$ /// Description : ///********************************************//// class $safeitemrootname${}} (2)E:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\ItemTemplates\CSharp\Code\2052\Interface\Interface.cs using System;using System.Collections.Generic;$if$ ($targetframeworkversion$ >= 3.5)using System.Linq;$endif$using System.Text;$if$ ($targetframeworkversion$ >= 4.5)using System.Threading.Tasks;$endif$namespace $rootnamespace${/// ///********************************************/// InterfaceName : $safeitemrootname$/// Author : WeiXiaolei/// CreateTime : $time$ /// Description : ///********************************************//// interface $safeitemrootname${}} (3)E:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\ItemTemplates\CSharp\Code\2052\WebClass\Class.cs using System;using System.Collections.Generic;$if$ ($targetframeworkversion$ >= 3.5)using System.Linq;$endif$using System.Web;namespace $rootnamespace${/// ///********************************************/// ClassName : $safeitemrootname$/// Author : WeiXiaolei/// CreateTime : $time$ /// Description : ///********************************************//// public class $safeitemrootname${}} 修改完成,在 Visual Studio 2019 编辑器中添加新类 HelloWorld.cs,出现自定义头部注释如下: using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace WindowsFormsApp1{/// ///********************************************/// ClassName : HelloWorld/// Author : WeiXiaolei/// CreateTime : 2021/11/4 12:15:09 /// Description : ///********************************************//// class HelloWorld{}} 添加新接口 IHello.cs,出现自定义头部注释如下: using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace WindowsFormsApp1{/// ///********************************************/// InterfaceName : IHello/// Author : WeiXiaolei/// CreateTime : 2021/11/4 12:15:40 /// Description : ///********************************************//// interface IHello{}} Visual Studio 2019 C# 代码添加头部注释成功。 |
CopyRight 2018-2019 实验室设备网 版权所有 |